@extends('admin.layout.index')
@section('content')
	<div class="span12">

		<!-- BEGIN EXAMPLE TABLE PORTLET-->

		<div class="portlet box light-grey">

			<div class="portlet-title">

				<div class="caption"><i class="icon-th"></i>后台用户列表</div>

				<div class="tools">


					<a href="javascript:;" class="reload"></a>


				</div>

			</div>

			<div class="portlet-body">

				<div class="clearfix">

					<div class="btn-group"style="float:left" >
						<a href="/admin/user/create" >
						<button id="sample_editable_1_new" class="btn green">

						添加新用户 <i class="icon-plus"></i>

						</button>
						</a>

					</div>
					<div class="row-fluid" style="float:right; width:500px;"><div class="span6" style="float:right; width:300px;"><div class="dataTables_filter" id="sample_1_filter">
						<form action="/admin/user" method="get">
							<label>
								<input type="text" aria-controls="sample_1" class="m-wrap medium" value="{{$request['search'] or ''}}" name="search">
								<button class="btn blue" >搜索</button>
							</label>
						</form>
					</div></div></div>


				</div>

				<table class="table table-striped table-bordered table-hover dataTable" id="sample_1" aria-describedby="sample_1_info">

					<thead>

						<tr role="row">
						
						<th class="sorting" role="columnheader" tabindex="0" aria-controls="sample_1" rowspan="1" colspan="1" aria-label="Username: activate to sort column ascending" style="width: 153.048px;">id</th>
						<th class="sorting" role="columnheader" tabindex="0" aria-controls="sample_1" rowspan="1" colspan="1" aria-label="Username: activate to sort column ascending" style="width: 153.048px;">用户名</th>
						<th class="sorting" role="columnheader" tabindex="0" aria-controls="sample_1" rowspan="1" colspan="1" aria-label="Username: activate to sort column ascending" style="width: 153.048px;">创建时间</th>
						<th class="sorting" role="columnheader" tabindex="0" aria-controls="sample_1" rowspan="1" colspan="1" aria-label="Username: activate to sort column ascending" style="width: 153.048px;">权限</th>
						<th class="sorting" role="columnheader" tabindex="0" aria-controls="sample_1" rowspan="1" colspan="1" aria-label="Username: activate to sort column ascending" style="width: 153.048px;">操作</th>

					</thead>

					@if (count($errors) > 0)
						<script>
							alert('{{ $errors }}');
						</script>
					@endif
				<tbody role="alert" aria-live="polite" aria-relevant="all">
					@foreach($data as $k=>$v)
					<tr class="gradeX odd">
						<td class=" ">{{$v['id']}}</td>
						<td class=" ">{{$v['username']}}</td>
						<td class=" ">{{$v['ctime']}}</td>
						<td class=" ">{{$v['status']}}</td>
						<td class=" ">
							<a href="/admin/user/{{ $v['id'] }}/edit"><button class="btn mini purple" style="float:left"><i class="icon-edit"></i> 修改</button></a>
							<span style="float:left" > &nbsp;| &nbsp;</span>	 
							<form action="/admin/user/{{$v['id']}}" method="post" style="float:left; margin:0px">
								{{ csrf_field() }}
								<input type="hidden" name="_method" value="DELETE">
								<button class="btn mini black"><i class="icon-trash"></i> 删除</button>
							</form>
							
						</td>
					</tr>
					@endforeach

				</tbody></table><div class="row-fluid"><div class="span6"><div class="dataTables_info" id="sample_1_info"></div></div><div class="span6"><div class="dataTables_paginate paging_bootstrap pagination">{!! $data->appends($request)->render()!!}</div></div></div></div>

			</div>

		</div>
		<script type="text/javascript">
			$('.pagination').addClass('dataTables_paginate paging_bootstrap')
			$('.disabled').addClass('prev')
		</script>
		<!-- END EXAMPLE TABLE PORTLET-->

	</div>
@endsection